import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { StorageProvider } from '../../providers/storage/storage';
import { ConfigProvider } from '../../providers/config/config';
import { ToolsProvider } from '../../providers/tools/tools';
import { LoginPage } from '../login/login';
import { AddressPage } from '../address/address';

/**
 * Generated class for the OrderPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-order',
  templateUrl: 'order.html',
})
export class OrderPage {

  public list = [];
  public userinfo = '';
  public LoginPage = LoginPage;
  // public AddressPage = AddressPage;

  constructor(public navCtrl: NavController, public navParams: NavParams, public storage:StorageProvider, public config:ConfigProvider, public tools:ToolsProvider) {
    //获取提交订单的商品数据
    this.list = this.storage.get('order_data');
    console.log(this.list);

  }

  ionViewDidEnter(){
    //从localStorage获取用户信息
    this.userinfo = this.tools.getUserinfoData();
    console.log(this.userinfo);
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad OrderPage');
  }

  pushAddressPage(){
    console.log('跳转页面');
    this.navCtrl.push(AddressPage);
  }

}
